#version 300 es
uniform int groupCount;
uniform int count;
uniform float lifeSpanStep;
in vec4 tPosition;
in vec4 aPosition;
out vec4 vPosition;
void main()     
{
	vec4 position=aPosition;
	if(aPosition.w==10.0)
	{
		int id=gl_VertexID;
		if((count*groupCount)<=id&&id<(count*groupCount+groupCount)) 
		{
			position.w=lifeSpanStep;
		}
		vPosition=position;
	}else
	{
		position.w=position.w+lifeSpanStep;
		if(position.w>tPosition.w)
		{
			position.x=tPosition.x;
			position.y=tPosition.y;
			position.w=10.0;
		}else
		{
			position.x=position.x+position.z;
			position.y=position.y+tPosition.z;
		} 
		vPosition=position;
	}
}                      